package com.liuzh.deviceinfo.card;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.cardview.widget.CardView;
import c.h.a.q;

public class PercentCard extends CardView {
    public TextView j = ((TextView) findViewById(2131296790));
    public TextView k = ((TextView) findViewById(2131297011));
    public TextView l = ((TextView) findViewById(2131297054));
    public TextView m = ((TextView) findViewById(2131296891));
    public ProgressBar n = ((ProgressBar) findViewById(2131296806));

    public PercentCard(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        View.inflate(getContext(), 2131492933, this);
        setUseCompatPadding(true);
        this.n.setMax(100);
        if (attributeSet != null) {
            TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, q.d);
            this.l.setText(obtainStyledAttributes.getText(1));
            ((ImageView) findViewById(2131296628)).setImageResource(obtainStyledAttributes.getResourceId(0, 2131558405));
            obtainStyledAttributes.recycle();
        }
    }

    @SuppressLint({"SetTextI18n"})
    public void setPercent(float f) {
        int i = (int) (f * 100.0f);
        TextView textView = this.j;
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(i);
        stringBuilder.append("%");
        textView.setText(stringBuilder.toString());
        this.n.setProgress(i);
    }

    public void setProgressIndeterminate(boolean z) {
        this.n.setIndeterminate(z);
    }

    public void setShortInfo(String str) {
        this.m.setText(str);
        this.m.setVisibility(0);
    }

    public void setSummary(CharSequence charSequence) {
        this.k.setText(charSequence);
    }

    public void setTitle(CharSequence charSequence) {
        this.l.setText(charSequence);
    }

    public void setTitle(int i) {
        this.l.setText(i);
    }
}
